package com.wk.springboot.ttl.context;

import com.alibaba.ttl.TransmittableThreadLocal;

public class RequestContext {
    //使用TransmittableThreadLocal来存储请求ID
    private static final ThreadLocal<String> requestIdTL = new TransmittableThreadLocal<>();

    public static String getRequestId() {
        return requestIdTL.get();
    }

    public static void setRequestId(String requestId) {
        requestIdTL.set(requestId);
    }

    public static void clear() {
        requestIdTL.remove();
    }
}